﻿using System.Web.Mvc;
using ZSoftPintrest.Services.Abstraction;
using ZSoftPintrest.UI.ViewModels;

namespace ZSoftPintrest.UI.Web.Controllers
{
    public class ChannelController : Controller
    {
        IChannelService _service;
        public ChannelController(IChannelService service)
        {
            this._service = service;
        }

        public ActionResult Index()
        {
            return View();
        }

        // GET: Channel/Details/5
        public ActionResult Details(int id)
        {
            return View();
        }

        // GET: Channel/Create
        public ActionResult Create()
        {
            return View();
        }

        // POST: Channel/Create
        [HttpPost]
        public ActionResult Create(ChannelCreateModel model)
        {
            try
            {
                // TODO: Add insert logic here
                this._service.Create(model);
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }

        // GET: Channel/Edit/5
        public ActionResult Edit(int id)
        {
            return View();
        }

        // POST: Channel/Edit/5
        [HttpPost]
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add update logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }

        // GET: Channel/Delete/5
        public ActionResult Delete(int id)
        {
            return View();
        }

        // POST: Channel/Delete/5
        [HttpPost]
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
    }
}
